// JavaScript Document

$(document).ready(function(){
    var box = $(".indexp3_img");
    var boxTop = box.offset().top;    //元素到页面顶部的距离
    $(document).scroll(function(){
        var winScrollTop = $(window).scrollTop();    //获取窗口滚动的距离
        console.log(winScrollTop);
        if(winScrollTop > boxTop){
            box.addClass("indexp3_imgxf");
        }else{
            box.removeClass("indexp3_imgxf");
        }
    });
});
$(document).ready(function(){
    var box = $(".indexp5_img");
    var boxTop = box.offset().top;    //元素到页面顶部的距离
    $(document).scroll(function(){
        var winScrollTop = $(window).scrollTop();    //获取窗口滚动的距离
        console.log(winScrollTop);
        if(winScrollTop > boxTop){
            box.addClass("indexp3_imgxf");
        }else{
            box.removeClass("indexp3_imgxf");
        }
    });
});

$(function(){
    $('a[href*=#],area[href*=#]').click(function() {


        $(".pc_nav li").removeClass('pc_nav_hover');
        $(this).parent().addClass('pc_nav_hover');

        if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({
                        scrollTop: targetOffset
                    },
                    1000);
                return false;
            }
        }
    });
})





$(document).ready(function(){
    $(".pc_nav li a").click(function(){
        $(".sj_nav").removeClass("sj_navhover");
        $(".sj_x").removeClass("sj_xhover");
        $(".logo").removeClass("sj_logo");
    });
});


/**
 * 禁用右键菜单
 */
document.oncontextmenu = function(){
    event.returnValue = false;
};
/**
 * 禁用选中功能
 */
document.onselectstart = function(){
    event.returnValue = false;
};
/**
 * 禁用复制功能
 */
document.oncopy = function(){
    event.returnValue = false;
};
/**
 * 禁用鼠标的左右键
 * @param {Object} e
 */
document.onmousedown = function(){
    if(event.which==1){//鼠标左键
        return false;
    }

    if(event.which==3){//鼠标右键
        return false;
    }
};

/**
 * 获取键盘上的输入值
 */
document.onkeydown = function(){
    console.info(event.which);
    if(event.which==13){
        console.info("回车键");
    }
};

